home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
vidbasic.zip
/
VIDEO.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-11-29
|
17KB
|
400 lines
;«RM82»«TS8,16,24,32,40,48,56,64»
; Updated 11/20/90
;=======================================================================
; Copyright (C) Copr. 1990 by Sidney J. Kelly
; All Rights Reserved.
; Sidney J. Kelly
; 150 Woodhaven Drive
; Pittsburgh, PA 15228
; home phone 412-561-0950 (7pm to 9:30pm EST)
;-----------------------------------------------------------------------
; Function prototype in QBASIC
; DECLARE FUNCTION VideoStat% ()
;
; VideoStatus Analyzer
; Program returns video information for use by QBASIC
; returns highest level of SCREEN mode supported by the Hardware.
; Returns information about the PRIMARY display only
; This routine with a select case, can tell you how many display pages
; are available in text mode, SCREEN 0:
; VGA has 8 pages
; EGA with > 64kb has 8 pages
; EGA with 64kb has 4 pages
; CGA has 4 pages
; MONO has 1 pages
; HERC has 1 page in SCREEN 0, 2 pages in SCREEN 3
;
; Exceptions:
; MCGA color returns a mode 11, so can contrast w/ VGA
; HERC w/o MSHERC.COM reports a -3 so you can tell user to correct matters
; COMPAQ with CGA reports -2 so can force use of monchrome attributes.
; EGA's with CGA diplays report -8 if have only 64kb of memory
; EGA's with ECD display report 8 if have only 64kb of memory
;
; Returns:
; Mono = 0
; CGA = 2
; PGA = 2 (Untested, assume PGA would be treated as CGA)
; COMPAQ - CGA = -2 to tell that user may have a single color display
; HERC = 3 if have HERC and MSHERC.COM
; HERC = -3 if have HERC but w/o MSHERC.COM
; AT&T = 4, but only if have just CGA display, not EGA or VGA
; Microsoft QuickC/C makes Olivetti EGA and VGA return a separate code.
; I don't know why anyone would care if the EGA/VGA emulation were
; good.
;
; EGA64 = 8 Because resolution limited for 64k EGA
; EGA64 w/CGA = -8 Because resolution limited to CGA modes
; EGA = 9 Have minimum of 128kb of video ram
; EGA w/CGA = -9 Since resolution limited to CGA modes
; MCGA = 11 If have an analog color display
; MCGA = -11 If have an EGA ECD digital color display, since
; resolution of this display is limited to EGA modes
; VGA = 13
; EGA/VGA mono = 10 I guess will catch MCGA mono too
;
; Version 0.92
;
; Tested: CGA, HERC clone, EGA mono, EGA color, VGA color, COMPAQ CGA,
; VGA clone, EGA clone (Paradise clone, ATI EGA Wonder), AT&T 6300
; Not tested: PGA, VGA monochrome, MCGA (color or monochrome)
;=======================================================================
DOSSEG ;I have had problems unless this is used
.model medium ;I use QUICK C / QUICK ASM which uses MASM 5.1 simplified
.code ;directives
public VIDEOSTAT
HERC_PORT Equ 03bah ; Herc display status port
COMPAQ DB 'COMPAQ' ; BIOS ID string in COMPAQ's
COMPAQ_LEN Equ 6 ; length of string
;Following is commented out because alternative method is faster
;ATT DB 'OLIVETTI' ; BIOS ID string for OLIVETTI/AT&T
;ATT_LEN Equ 8 ; length of string
; Please do not remove
Copyright DB 13,10,'Copyright Copr. (C) 1990 Sidney J. Kelly',13,10
Copyright1 DB 'All Rights Reserved',13,10,26
EVEN
VIDEOSTAT PROC far
Push BP ; save BP because old PC Video BIOS
; didn't necessarily preserve this
Push DI ; QBASIC requires these 2 to be saved
Push SI
; this just tests for primary display
vgatest: ; because that is all QBASIC cares about
Mov AX,1A00h
Mov BX,10h ; Test for VGA adapter
Int 10h
Cmp AL,1Ah ; If VGA adapter exists, it returns AL=1Ah
Jne egatest ; VGA does not exist so test for EGA
; Else VGA exists, primary display info
Cmp BL,8 ; routine returns primary display in BL
Jne @F
Jmp Short vga_color ; VGA color exists. This does not test
; if VGA adapter clone is in emulation
; mode, such as HERC emulation
; because QBASIC does not check
; for this either.
@@:
Cmp BL,7
Jne @f
Jmp vga_mono ; VGA mono exists, no effort is made to
; distinguish between VGA, EGA or MCGA mono
@@:
Cmp BL,11
Jne @f
Jmp vga_mono ; MCGA mono exists
@@:
Cmp BL,12
Jne @f
Jmp Short mcga_color ; MCGA analog color exists
@@:
Cmp BL,10
Jne @f
Jmp Short mcga_ecd ; MCGA w/EGA display (untested)
@@:
Cmp BL,4 ; EGA color screen found, we have to
Jne @f ; test if EGA is attached to ECD
Jmp Short egatest ; monitor or just plain CGA monitor
@@:
Cmp BL,5
Jne @f
Jmp Short vga_mono ; EGA mono screen found
@@:
Cmp BL,2
Jne @F
Jmp Short att_test ; CGA color found, test for which type
@@:
Cmp BL,1
Jne @f
Jmp herctest ; MDA mono found
@@:
Cmp BL,6 ; test for PGA, treat as a CGA
Jne @f
Jmp cga ; I guess this should work, untested
@@: ; With everything else
Jmp unknown ; merely assume can do normal b&w text
egatest:
Mov AX,1200h
Mov BX,10h
Int 10h
Cmp BL,10h ; EGA changes BL from 10h
Je cgatest
Mov DX,BX ; Save BX temporarily in DX
Xor BX,BX
Mov ES,BX
Test ES:Byte Ptr [487h],1000b ;EGA active?, bit 3 of 0040:0087 set?
JZ EGA_active ; if bit clear, then EGA is active
Jmp Short cgatest ; else if EGA not active (primary) check CGA
EGA_active:
Mov BX,DX ; get former value back from CX
Or BH,BH ; if BH = 1 then have MONO display
JZ ega_color ; else have color display
Jmp Short vga_mono ; treat as a VGA mono
vga_color:
Mov AX,13 ; max screen mode is QBASIC SCREEN 13
Jmp Quit
mcga_color:
Mov AX,11 ; near max screen mode is QBASIC SCREEN 11
Jmp Quit ; MCGA can do SCREEN 13 too, but not 12.
mcga_ecd:
Mov AX,-11 ; a warning that MCGA has EGA display
Jmp short Quit ; attached (Untested)
ega_color:
;*********** Based on information returned by AH 12h, BL 10h of INT 10h,
;*********** this routine reads the EGA Sense switches stored in CL
;*********** to see if really have a primary monitor that can do EGA graphics.
;*********** If do not have an ECD/multisync display, report a -9.
;*********** If have a 64kb EGA reports 8 if have ECD or -8 if have CGA
;*********** It is unclear if this will work on all clone EGA's.
;*********** It works with a VGA clone and ATI EGA Wonder as well as an
;*********** ACER EGA clone.
;*********** CL information derived from RAM memory at 0040:0088h
;***********
;*********** Source of CL information:
;*********** Ferro, "Programmer's Guide to the EGA and VGA Cards,"
;*********** (Addison-Wesley 1988), page 337. Yet on page 473 says you can't
;*********** tell what CL will report.
;*********** Similar information hidden in Wilton, "Programmer's Guide to
;*********** PC & PS/2 Video Systems" (Microsoft 1987), page 520.
;***********
;*********** Partial information set forth in Phoenix's "System Bios for
;*********** PC/XT/AT Computers and Compatibles (Addison-Wesley 1989)
;*********** page 243 (which states t